<template>
      <a-upload
      :file-list="fileList"
      name="file"
      :multiple="true"
      :disabled="true"
    >
     
    </a-upload>
</template>
<script>
import { getFile } from '@/api/apply/apl_form.js'
export default {
  props: {
    // 枚举值
    value: {
      require: true,
    },
  },
  data() {
    return {
      myValue: this.value ? String(this.value) : null,
      fileList: [], // 回显文件列表
    }
  },
  created() {
    this.getFileData(this.myValue)
  },
  methods: {
    // 附件回显
    getFileData(ids) {
      let idArr = ids.split(',')
      idArr.forEach((v) => {
        getFile({ id: v }).then((res) => {
          // console.log('附件回显', res)
          if (res.data == null) {
            console.warn('无效附件id', v)
          } else {
            let file = {
              uid: res.data.id,
              name: res.data.name,
              status: 'done',
              url: res.data.url,
            }
            this.fileList.push(file)
          }
        })
      })
    },
  }
}
</script>

<style lang="scss" scoped>

</style>
